//鼠标悬浮按钮样式变化
$(".change-btn").mouseover(function(){
	$(".change-btn em").css({
		"height":"110px",
		"width":"200px",
		"transform": "translateX(0) translateY(0) rotate(0deg)"
	});
	$(".change-btn span").css({"color":"white"});
});
$(".change-btn").mouseout(function(){
	$(".change-btn em").css({
		"height":"",
		"width":"",
		"transform": ""
	});
	$(".change-btn span").css({"color":""});
});
//点击按钮切换新闻内容
$(".change-btn").click(function(){
	$(".news1").toggle();
	$(".news2").toggle();
});
//轮播图1
$(function(){
	var nowImg = 0;
	var count = 2;
	//轮播图每3000ms淡入,用时400ms
	function start(){
		time = setInterval(function(){
			if(nowImg < count - 1){
				$(".first-focus-item").eq(nowImg + 1).animate({"opacity":1},400,function(){
					$(this).css("display:block");
				});
				$(".first-focus-item").eq(nowImg + 1).siblings().animate({"opacity":0},400,function(){
					$(this).css("display:none");
				});
				$(".first-focus-indicator i").eq(nowImg + 1).addClass("first-focus-indicator-btn-active").removeClass("first-focus-indicator-btn")
				.siblings().removeClass("first-focus-indicator-btn-active").addClass("first-focus-indicator-btn");
				nowImg++;
			}
			else{
				$(".first-focus-item").eq(0).animate({"opacity":1},400,function(){
					$(this).css("display:block");
				});
				$(".first-focus-item").eq(0).siblings().animate({"opacity":0},400,function(){
					$(this).css("display:none");
				});
				$(".first-focus-indicator i").eq(0).addClass("first-focus-indicator-btn-active").removeClass("first-focus-indicator-btn")
				.siblings().removeClass("first-focus-indicator-btn-active").addClass("first-focus-indicator-btn");
				nowImg = 0;
				return nowImg;
			}
		},3000);
	}
	start();
	//鼠标悬浮后轮播暂停，离开后继续
	$(".first-focus-list").hover(function(){
		clearInterval(time);
	},start);
	//鼠标悬浮指示器，图片相应轮播
	$(".first-focus-indicator i").mouseover(function(){
		$(this).removeClass("first-focus-indicator-btn").addClass("first-focus-indicator-btn-active")
		.siblings().removeClass("first-focus-indicator-btn-active").addClass("first-focus-indicator-btn");
		var index = $(this).index();
		$(".first-focus-item").eq(index).animate({"opacity":1},400,function(){
			$(this).css("display:block");
			nowImg = index;
			return nowImg;
		});
		$(".first-focus-item").eq(index).siblings().animate({"opacity":0},400,function(){
			$(this).css("display:none");
		});
	});
});
//轮播图2
$(function(){
	var nowImg = 0;
	var count = 2;
	//轮播图每3000ms淡入,用时400ms
	function start(){
		time = setInterval(function(){
			if(nowImg < count - 1){
				$(".second-focus-item").eq(nowImg + 1).animate({"opacity":1},400,function(){
					$(this).css("display:block");
				});
				$(".second-focus-item").eq(nowImg + 1).siblings().animate({"opacity":0},400,function(){
					$(this).css("display:none");
				});
				$(".second-focus-indicator i").eq(nowImg + 1).addClass("second-focus-indicator-btn-active").removeClass("second-focus-indicator-btn")
				.siblings().removeClass("second-focus-indicator-btn-active").addClass("second-focus-indicator-btn");
				nowImg++;
			}
			else{
				$(".second-focus-item").eq(0).animate({"opacity":1},400,function(){
					$(this).css("display:block");
				});
				$(".second-focus-item").eq(0).siblings().animate({"opacity":0},400,function(){
					$(this).css("display:none");
				});
				$(".second-focus-indicator i").eq(0).addClass("second-focus-indicator-btn-active").removeClass("second-focus-indicator-btn")
				.siblings().removeClass("second-focus-indicator-btn-active").addClass("second-focus-indicator-btn");
				nowImg = 0;
				return nowImg;
			}
		},3000);
	}
	start();
	//鼠标悬浮后轮播暂停，离开后继续
	$(".second-focus-list").hover(function(){
		clearInterval(time);
	},start);
	//鼠标悬浮指示器，图片相应轮播
	$(".second-focus-indicator i").mouseover(function(){
		$(this).removeClass("second-focus-indicator-btn").addClass("second-focus-indicator-btn-active")
		.siblings().removeClass("second-focus-indicator-btn-active").addClass("second-focus-indicator-btn");
		var index = $(this).index();
		$(".second-focus-item").eq(index).animate({"opacity":1},400,function(){
			$(this).css("display:block");
			nowImg = index;
			return nowImg;
		});
		$(".second-focus-item").eq(index).siblings().animate({"opacity":0},400,function(){
			$(this).css("display:none");
		});
	});
});